<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Insert title here</title>
<link href="${pageContext.request.contextPath }/css/admin/common.css" type="text/css" rel="stylesheet">
	<style type="text/css">
		table{
			text-align: center;
			border-collapse: collapse;
		}
		.bgcolor{
		  	background-color: #F08080;
		}
	</style>
	<style type="text/css">
	table{
		border-color:green;
		margin-left:20px;
		margin-top:20px;
		width:600px;
	}
	table tr td{
		padding:10px 5px;
		font-size: 12px;	
	}
	table tr:nth-child(odd){
		background-color: #eee;
		font-size:12px;
	}
	table tr td input[type=submit],table tr td input[type=reset]{width:137px;height:35px; background:url(images/btnbg.png) no-repeat; font-size:14px;font-weight:bold;color:#fff; cursor:pointer;}
	table tr td input[type=text]{width:345px; height:25px; line-height:25px; border-top:solid 1px #a7b5bc; border-left:solid 1px #a7b5bc; border-right:solid 1px #ced9df; border-bottom:solid 1px #ced9df;text-indent:10px;}
	select{width:105px; height:25px; line-height:25px; border-top:solid 1px #a7b5bc; border-left:solid 1px #a7b5bc; border-right:solid 1px #ced9df; border-bottom:solid 1px #ced9df;text-indent:10px;}
	table tr td:first-child{padding-left:23px;line-height:25px; font-weight: bold;text-align: center;}
	table tr th{height:50px;}
	form{margin-left:20px;margin-top:20px;}
	input[type=submit]{width:60px;margin-left:20px;}
	
</style>

<script type="text/javascript">
	var tempName="";
		function changeColor(obj){
			tempName=obj.style.backgroundColor;
			//obj.className = "bgcolor";
			obj.style.backgroundColor="#F08080";
		}
		function changeColor1(obj){
			obj.style.backgroundColor=tempName;
		}
		function checkDel(aname,apwd){
  			if(window.confirm("是否删除该用户？")){
  				window.location.href = "${pageContext.request.contextPath }/admin/deleteUser?aname="+aname+"&apwd="+apwd;
  			}
  		}
		
	</script>
</head>
<body>
	<c:if test="${ausers.size() == 0 }">
		您还没有类型。
	</c:if>
	<c:if test="${ausers.size() != 0 }">
		<table border="1" bordercolor="PaleGreen" >
			<tr>
				<th width="600px">用户名</th>
				<th width="600px">密码</th>
				<th width="600px">操作</th>
			</tr>
			<c:forEach items="${ausers }" var="auser">
				<tr onmouseover="changeColor(this)" onmouseout="changeColor1(this)">
					<td>${auser.aname }</td>
					<td>${auser.apwd }</td>
					<td><a class="buttonClass" href="javascript:checkDel('${auser.aname }','${ auser.apwd }')">删除</a></td>
				</tr>
			</c:forEach>
		</table>
	</c:if>
	<form action="${pageContext.request.contextPath }/admin/addUser" method="post" >
	<p><h3>添加管理员：</h3></p><br/>
	   
		管理员用户名:
		<input type="text" name="aname" required/>
		管理员密码：
		<input type="text" name="apwd" required/>
		<input type="submit" value="添加"/>
	</form>
	<form method="post" action="${pageContext.request.contextPath }/admin/updateUser" >
	<p><h3>修改管理员密码：</h3></p><br/>
		管理员用户名:
		<input type="text" name="aname" required/>
		管理员密码：
		<input type="text" name="apwd" required/>
		<input type="submit" value="修改">
	</form>
</body>
</html>